package com.yami.shop.service;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yami.shop.bean.model.Supplier;
import com.yami.shop.bean.model.SupplierProd;
import com.yami.shop.bean.vo.SupplierProdVO;
import com.yami.shop.common.util.PageParam;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletResponse;
import java.util.List;

/**
 *
 *
 * @author Citrus
 * @date 2021-09-07 10:12:32
 */
public interface SupplierProdService extends IService<SupplierProd> {

    /**
     * 搜索所有商品
     * @param supplierId
     * @return
     */
    List<SupplierProdVO> listSupplierProd(Long supplierId);

    /**
     * 搜索所有商品
     * @param supplierId
     * @return
     */
    List<SupplierProdVO> listSupplierProdByCache(Long supplierId);

    /**
     * 新增或保存
     * @param supplierProds
     * @param supplierId
     * @return
     */
    boolean addOrUpdate(List<SupplierProd> supplierProds,Long supplierId);

    /**
     * 下载模板
     * @param response
     */
    void downLoadModel(HttpServletResponse response);

    /**
     * 导入供应商商品
     * @param file
     * @param shopId
     * @param supplierId
     * @return
     * @throws Exception
     */
    Object parseFile(MultipartFile file, Long shopId, Long supplierId) throws Exception;

    /**
     * 导出供应商商品
     * @param supplierId
     * @param response
     */
    void exportSupplierProd(Long supplierId, HttpServletResponse response);

    /**
     * 当商品被商家删除时，根据商品id删除商品
     * @param prodId
     */
    void deleteByProdId(Long prodId);

    /**
     * 根据商品id查询供应商
     * @param prodId
     * @return
     */
    List<Long> listSupplierIdByProdId(Long prodId);

    /**
     * 根据skuId列表查询供应商
     * @param skuIds
     * @return
     */
    List<Long> listSupplierIdBySkuIds(List<Long> skuIds);

    /**
     * 供应商商品列表
     * @param pageParam
     * @param supplier
     * @param partyCode
     * @return
     */
    IPage<SupplierProdVO> supplierProdPage(PageParam<SupplierProdVO> pageParam, Supplier supplier, String partyCode);

    /**
     * 删除列表缓存
     * @param supplierId
     */
    void removeCacheBySupplierId(Long supplierId);

    /**
     * sku删除时，移除供应商商品关联的sku
     * @param prodId
     * @param skuIds
     */
    void deleteByProdId(Long prodId, List<Long> skuIds);

    /**
     * 自采供应商商品分页
     * @param pageParam
     * @param supplier
     * @param partyCode
     * @return
     */
    IPage<SupplierProdVO> defaultSupplierProdPage(PageParam<SupplierProdVO> pageParam, Supplier supplier, String partyCode);

    /**
     * 根据商品编码获取供应商商品信息
     * @param partyCodeList
     * @return
     */
    List<SupplierProdVO> listSupplierProdByPartyCodeList(List<String> partyCodeList);
}
